
#include "iostream"
using namespace std;
#include "vector"
#include "unordered_map"
vector<int> twoSum(vector<int>& nums,int target){
    unordered_map<int,int> map;
    vector<int> num;
    for (int i = 0; i < nums.size(); ++i) {
        int s=target-nums[i];
        //iter是找到的值
        auto iter=map.find(s);
        if (iter!=map.end()){
            num[0]= iter->second;
            num[1]=i;
        }
        map.insert(pair<int,int>(nums[i],i));
    }
    return num;
}